package office.preview.jacob.core;

import com.jacob.activeX.ActiveXComponent;
import com.jacob.com.ComThread;
import com.jacob.com.Dispatch;
import com.jacob.com.Variant;

public class ConverHtml {
	public String Application;
	public String Property;
	public Integer Variant;

	protected void toHtml(String filePath, String tofilePath) {
		ActiveXComponent app = new ActiveXComponent(Application);
		app.setProperty("Visible", new Variant(false));
		Dispatch xls1 = app.getProperty(Property).toDispatch();
		Dispatch xls2 = Dispatch.invoke(xls1, "Open", Dispatch.Method,
				new Object[] { filePath, new Variant(false), new Variant(true) }, new int[1]).toDispatch();
		Dispatch.invoke(xls2, "SaveAs", Dispatch.Method, new Object[] {tofilePath, new Variant(Variant) }, new int[1]);
		Variant f = new Variant(false);
		Dispatch.call(xls2, "Close", f);
		app.invoke("Quit", new Variant[] {});
		ComThread.Release();
	}
}
